package com.ysd.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.ysd.dao.impl.ChanPinFenLeiDaoImpl;
import com.ysd.dao.impl.GongShiDaoImpl;
import com.ysd.dao.impl.TuiJianZXDaoImpl;
import com.ysd.dao.impl.XSTuiJianDaoImpl;
import com.ysd.entity.ChanPinFenLei;
import com.ysd.entity.ChanPinXinXi;
import com.ysd.entity.GongShi;
import com.ysd.entity.XiangQing;


public class HomeServlet extends HttpServlet {
	
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		//调用实现类
		GongShiDaoImpl gDao=new GongShiDaoImpl();
		GongShi g=gDao.getGongShi();
		request.setAttribute("g", g);
		
		ChanPinFenLeiDaoImpl cpDao=new ChanPinFenLeiDaoImpl();
		List<ChanPinFenLei> cpList= cpDao.getChanPinFenLeiList();
		request.setAttribute("cpList", cpList);
		
		XSTuiJianDaoImpl xsTJDao=new XSTuiJianDaoImpl();
		List<ChanPinXinXi> tjList=xsTJDao.getCPTuiJian();
		request.setAttribute("tjList", tjList);
		
		TuiJianZXDaoImpl tjZXDao=new TuiJianZXDaoImpl();
		List<XiangQing> tjxqList=tjZXDao.getTJXiangQ();
		request.setAttribute("tjxqList", tjxqList);
		
		request.getRequestDispatcher("index.jsp").forward(request, response);
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doGet(request, response);
	}

}
